<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8" isELIgnored="false" %>
<!DOCTYPE html>
<html lang="zh_CN">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>注册页面</title>
<!-- Bootstrap core CSS -->
<link href="static/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
<link href="static/css/taobao.css" rel="stylesheet" />
<script src="static/jquery/jquery.min.js"></script>
<script src="static/bootstrap/js/bootstrap.min.js"></script>
<script src="static/bootstrap/js/bootstrapValidator.min.js"></script>
   
   <script type="text/javascript">
        
      $(function(){
    	  
    	   //为注册按钮绑定点击事件
    	   $("#btn_submit").click(function(){
    		   
    		    var loginName = $("#loginName").val();
    		    var name = $("#name").val();
    		    var password = $("#password").val();
    		    var okPassword = $("#okPassword").val();
    		    var phone = $("#phone").val();
    		    var address = $("#address").val();
    		    var email = $("#email").val();
    		    
    		    if(!/^[0-9a-zA-Z_]{5,16}$/.test(loginName)){
    		    	 alert("您输入的账号不合法！");
    		    }else if(name== null || name== ""){
    		    	alert("您输入的姓名不合法！");
    		    }else if(!/^[0-9a-zA-Z_]{5,16}$/.test(password)){
    		    	alert("您输入的密码不合法！");
    		    }else if(password != okPassword){
    		    	alert("您两次输入的密码不一致！");
    		    }else if(!/^[1][3,4,5,7,8][0-9]{9}$/.test(phone)){
    		    	alert("手机号码不合法！");
    		    }else if(!/^(\w-*\.*)+@(\w-?)+(\.\w{2,})+$/.test(email)){
    		    	alert("邮箱不合法！");
    		    }else{
    		    	//提交表单
    		    	$("#registerForm").submit();
    		    }
    		    
    		    
    		   
    		   
    	   })
    	  
      })
   
   </script>
</head>
<body>
	<!-- 横幅导航条开始 -->
	
     <jsp:include page="/WEB-INF/view/common/nva.jsp"></jsp:include>
	<!--  横幅下方的主体开始 -->
	<div class="container">
		<div class="row info-content">
			<form id="registerForm" class="form-horizontal" method="post"
				action="register" style="margin-top: 20px;">
				<div class="form-group">
					<label class="col-sm-2 control-label">登录名称</label>
					<div class="col-sm-3">
						<input type="text" value="" id="loginName" name="login_name"
							class="form-control" placeholder="请输入您的登陆名称">
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label">真实姓名</label>
					<div class="col-sm-3">
						<input type="text" id="name" value="" name="name"
							class="form-control" placeholder="请输入您的真实姓名">
					</div>

				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label">登陆密码</label>
					<div class="col-sm-3">
						<input type="password" id="password" name="password"
							class="form-control" placeholder="请输入您的密码">
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label">确认密码</label>
					<div class="col-sm-3">
						<input type="password" id="okPassword" name="okpassword"
							class="form-control" placeholder="请输入您的确认密码">
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label">性别</label>
					<div class="col-sm-3">
						<label>男:</label><input name="sex" value="1" type="radio"
							checked="checked"> <label>女:</label><input
							name="sex" value="2" type="radio">
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label">联系电话</label>
					<div class="col-sm-3">
						<input type="text" id="phone" value="" name="phone"
							class="form-control" placeholder="请输入您的电话">
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label">地址</label>
					<div class="col-sm-8">
						<textarea id="address" name="address" rows="4" cols="30"
							class="form-control" placeholder="请输入您的地址信息"></textarea>
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label">电子邮箱:</label>
					<div class="col-sm-3">
						<input type="text" id="email" value="" name="email"
							class="form-control" placeholder="请输入您的邮箱">
					</div>
					<div class="col-sm-3">
						<span style="color: red;">${message}</span>
					</div>
				</div>

				<div class="form-group">
					<label class="col-sm-2 control-label"></label>
					<div class="col-sm-3">
						<button type="button" id="btn_submit" class="btn btn-success">
							<span class="glyphicon glyphicon-user">注册
						</button>
						<button type="reset" class="btn btn-info">
							<span class="glyphicon glyphicon-edit">重置
						</button>
					</div>
				</div>
			</form>
		</div>
		<footer>
			<p>&copy; 版权所有，欢迎借鉴</p>
		</footer>

		
	</div>
	<!--  横幅下方的主体结束 -->
</body>
</html>